
$.fn.loadLoginUser=function(){
    $.ajax({
        url:"../user/loginUser",
        type:"get",
        dataType:"json",
        success:function (result) {

            if (result.code==100){
                $("#loginUser_nav").append(result.extend.loginUser.userName);
                if (result.extend.loginUser.userType>1){
                    var area="["+result.extend.loginUser.area.parentArea.parentArea.areaName+""
                        +result.extend.loginUser.area.parentArea.areaName+""+
                        result.extend.loginUser.area.areaName+"]";
                    $("#loginUser_nav").append($("<small></small>").append(area));
                }
            }
        }
    })
}

$.fn.logout=function () {
    $.ajax({
        url:"../user/logout",
        type:"get",
        dataType:"json",
        success:function (result) {
            if (result.code==100){
                window.location.href=result.target;
            }
        }
    })
}
$(function () {
    $.fn.loadLoginUser();
});
$("#logout_nav").click(function () {
    $.fn.logout();
})